package com.potenza.training.resume.controller;

import com.potenza.training.resume.entity.AdvantageEntity;
import com.potenza.training.resume.service.AdvantageService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 个人优势
 *
 * @author lihonggang
 * @email lihonggang@gmail.com
 * @date 2021-07-15 15:52:55
 */
@RestController
@RequestMapping("resume/advantage")
public class AdvantageController {
    @Autowired
    private AdvantageService advantageService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("resume:advantage:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = advantageService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{resumeId}")
    @RequiresPermissions("resume:advantage:info")
    public R info(@PathVariable Integer resumeId){
		AdvantageEntity advantage = advantageService.infoid(resumeId);

        return R.ok().put("advantage", advantage);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("resume:advantage:save")
    public R save(@RequestBody AdvantageEntity advantage){
		advantageService.save(advantage);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("resume:advantage:update")
    public R update(@RequestBody AdvantageEntity advantage){
		advantageService.updateById(advantage);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("resume:advantage:delete")
    public R delete(@RequestBody Long[] ids){
		advantageService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
